/**
 * Created by hjqi on 2016/4/19.
 */

var config = require('../config/config').config;
var httpRequest = require('../common/httpRequest').httpRequest;
var _req = new httpRequest();

function libcAdvisor(){

}

libcAdvisor.prototype.getStatus = function(id){
    return new Promise(function (resolve, reject){
        var _url = 'http://'+config.kubernetes.host+ ':4194/api/v1.0/containers/system.slice/docker-'+id+'.scope';
        _req._request(_url, 'POST',{} , JSON.stringify({"num_stats":60,"num_samples":0}) , function (data, result, response) {
            if (data !== null && data.statusCode == 200 )
                resolve(data.data);
            else
                reject(result);
        });
    })
}




module.exports = libcAdvisor;